Welcome to the JavaScript
Back-end Capstone Project Demo. In this capstone project, you'll assume
the role of a back-end developer. You will be tasked with
creating the back end for a web application called SecondChance. The SecondChance application connects
users who wish to give away household item they no longer need. With users who are recycling and prefer to
find free household items to match their tastes rather than purchasing new ones. You can see the application's
architecture. You will develop several back-end APIs
to support this application. Let's take a look at the user
interface for these services, and then we will discuss the API endpoints
you will need to develop accordingly. Here is a sample UI for the listings page. The listing page allows users to browse
the gifted items other users have listed. Each item has a link that allows anyone
browsing to go to a details page that provides further details about the item. The details page UI shown here displays
information about a single item. In this example, the details page will
also contain a comment section that provides a way for users to communicate
with others about that item. Now let's look at the API endpoint for
the backend that you will develop. This API returns an array
of items from the database. This curl command displays the result
of a call to the items endpoint. It displays the JSON data for
all of the items in the database. Note that it returns the JSON data for
each item, including the item ID, the name of the item,
its category, and its condition. As shown in the UI, the API also supports returning
a single item by specifying its ID. Using a different curl command, you can see that it returns a 200 OK
status with the appropriate data. If no such item exists in
the database by design, the API returns a 404 not found error. Next, take a look at a sample
UI implementing the search API. This endpoint searches the listings
posted by other users. Users filter the gift listings by
various fields, including the category, item's age, condition, and
the household item they seek. The back-end functionality of the search
API searches the database for item attributes. This curl command shows the result of
searching for items named curtain. Note the use of the dash V, which uses verbose mode to see
the data associated with the item. Note that when the user searches for
something not contained in the database, the result is still a 200 OK message and
also returns an empty array. You will write a service that uses
a natural language library to perform sentiment analysis. The front end does not currently
require this service, but you might desire this
functionality at a later time. You could use sentiment analysis to
flag rude or inappropriate comments. Let's see what happens when using
the curl command with the input, "This is a great day for humanity,
we're all very excited." The service returns a positive or
negative sentiment score. It also tells you whether the sentiment
is positive, negative, or neutral. The output for these sentences
result in a positive sentiment. The sentiment score ranges from
negative one to positive one. A positive value indicates
a positive statement, while a negative score
indicates a negative statement. The application also securely manages
user profile data and authentication. You will handle authentication using JSON
web tokens to securely communicate with the database. You will write the APIs for
users to log in, register, and update their credentials securely when the
front end requires one of these actions. The front end calls for one of these
actions when the user attempts to access an item's detail page upon login attempt, upon registering, when
submitting a change to their profile. With that,
we come to the end of this project demo. We hope this provides a good look at
the application's back end, which supports the user interface. You will learn much about JavaScript
back-end development through the creative problem-solving process required while
coding this SecondChance application. Good luck. [MUSIC]